package com.yjtravel.strategy;

/**
 * @author 28336
 * @version 1.0
 * Create by 2024/3/29 9:34
 */
public class CashContext {

    private CashSuper cs;

    public CashContext(int cashType) {
        if(cashType == 1){
            this.cs = new CashNormal();
        }else if(cashType == 2){
            this.cs = new CashRebate(0.8);
        }else if(cashType == 3){
            this.cs = new CashRebate(0.7);
        }else if(cashType ==4){
            this.cs = new CashReturn(300, 100);
        }
    }

    public double getResult(double price, double num){
       return cs.acceptCash(price, num );
    }
}
